<template>
    <div class="bar bar-header-secondary" v-if="show_searchbar">
        <div class="searchbar">
            <a class="searchbar-cancel">取消</a>
            <div class="search-input">
                <label class="icon icon-search" for="search"></label>
                <input type="search" v-model="key_words" id='search' placeholder='输入关键字...' @keyup.enter="submit"/>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'SearchBar',
        props: ['show_searchbar'],
        data (){
            return {
                key_words: ''
            }
        },
        methods: {
            submit(){
                this.$emit('enter_searchbar', this.key_words)
            }
        }
    }
</script>

<style>

</style>